﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace CMS.BLL
{
    public class EPioneerVersionsBLL
    {
        DAL.EPioneerVersionsDAL dal = new DAL.EPioneerVersionsDAL();
        /// <summary>
        /// 查询所有版本信息
        /// </summary>
        /// <returns></returns>
        public List<Entity.EPioneerVersionsModel> GetListEPioneerVersions()
        {
            List<Entity.EPioneerVersionsModel> list = new List<Entity.EPioneerVersionsModel>();
            DataTable dt = dal.GetEPioneerVersions();
            if (dt != null)
            {
                int rowsCount = dt.Rows.Count;
                Entity.EPioneerVersionsModel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Entity.EPioneerVersionsModel();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = Convert.ToInt32(dt.Rows[n]["id"]);
                    }
                    if (dt.Rows[n]["create_time"] != null && dt.Rows[n]["create_time"].ToString() != "")
                    {
                        model.create_time = Convert.ToDateTime(dt.Rows[n]["create_time"]);
                    }
                    model.clientver = dt.Rows[n]["clientver"].ToString();
                    model.description = dt.Rows[n]["description"].ToString();
                    model.isPub = dt.Rows[n]["isPub"].ToString();
                    model.outver = dt.Rows[n]["outver"].ToString();
                    list.Add(model);
                }
            }
            return list;
        }

        /// <summary>
        /// 添加版本信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Add(Entity.EPioneerVersionsModel model)
        {
            int count = dal.Add(model);
            if (count > 0)
                return true;
            else
                return false;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(string[] list, string isPub)
        {
            return dal.Update(list, isPub);
        }
    }
}
